package com.hdy.javachatroomdemo.Config;

import com.hdy.javachatroomdemo.Controller.TestWebSocketController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
//固定写法
@Configuration
@EnableWebSocket
public class TestWebSocketConfig implements WebSocketConfigurer {
    @Autowired
    TestWebSocketController testWebSocketController;
    @Override
    //把handle类进行注册
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
        registry.addHandler(testWebSocketController,"/TestWebSocketMessage");
    }
}
